This is a website to hold the maps created from Google Places API retrievals. You can look at each map by clicking on the site name in the Maps navigation menu above or by selecting a site from the list below.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
Hover over a point to see the name of the business. Click a point to see its address and a link to the business’s Google Maps page.
---
title: "Raised Median Maps"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
theme: yeti
source_code: embed
---
```{r setup, include=FALSE}
# This website was created by Michelle Plunkett in December 2017.
# Michelle is a Graduate Student Worker at the Texas A&M Transportation Institute.
# She is a Master of Public Affairs candidate (Class of 2018) at UT Austin's LBJ School of Public Affairs.
# Contact Information: mplunkett@utexas.edu
if (!require("pacman")) install.packages("pacman")
pacman::p_load(viridis, flexdashboard, knitr)
pacman::p_load_gh('rstudio/leaflet','bhaskarvk/leaflet.extras','rstudio/DT')
wd <- "C:\\Users\\Michelle\\Documents\\Projects\\Raised Median Maps\\"
setwd(wd)
# Load Places Objects from previous script run (1:13 is number of sites total)
sites <- 1:13
for (i in 1:length(sites)) {
load(file=paste0(wd,"Site_",i,".Rdata"))
tmp <- get(paste0("Site_",i))
tmp$Website <- paste0("",tmp$Website,"")
paltemp <- colorFactor(rainbow(length(unique(tmp$Main_Type))), tmp$Main_Type)
nam <- paste0("Site_",i)
nam2 <- paste0("typepal",i)
assign(nam, tmp)
assign(nam2, paltemp)
}
# Labels
labels <- c("Site 1 - Koenig Ln",
"Site 2 - FM 973",
"Site 3 - Aquarena Springs Dr",
"Site 4 - TX-80",
"Site 5 - US-79/Palm Valley Blvd",
"Site 6 - FM 620",
"Site 7 - TX-29/University Ave",
"Site 8 - FM 1460/AW Grimes Blvd",
"Site 9 - FM 1431/Whitestone Blvd",
"Site 10 - FM 1431/Whitestone Blvd",
"Site 11 - FM 1431/Whitestone Blvd",
"Site 12 - FM 685",
"Site 13 - FM 685")
# Create html widgets for each site
for (i in 1:length(sites)) {
# Create all leaflet maps
tmp <- get(paste0("Site_",i))
temppal <- get(paste0("typepal",i))
tempmap <- leaflet(data = tmp, width = "100%") %>%
addTiles(urlTemplate = "https://mts1.google.com/vt/lyrs=s&hl=en&src=app&x={x}&y={y}&z={z}&s=G",
group = "Google", attribution = 'Google') %>%
addTiles(urlTemplate = "http://mt0.google.com/vt/lyrs=y&hl=en&x={x}&y={y}&z={z}&s=Ga",
group = "Hybrid", attribution = "Google") %>%
addProviderTiles("Esri.WorldImagery", group = "ESRI") %>%
addCircleMarkers(~Longitude, ~Latitude,
radius=9,
fillColor = ~temppal(Main_Type),
stroke=T, color = "#FFFFFF", opacity = 0.8, fillOpacity = 0.9,
popup = ~paste(paste0("",
tmp$Name,""),
tmp$Full_Address,
paste0("Place Type: ",
tmp$Main_Type),sep="
"),
label = ~as.character(tmp$Name),
group = "Markers") %>%
addLegend("bottomright",
pal = temppal,
values = ~Main_Type,
labels = "Business Type ",
title = "Business Types",
group = "Legend") %>%
addLayersControl(baseGroups = c("Google", "Hybrid", "ESRI"),
overlayGroups = c("Legend"),
options = layersControlOptions(collapsed = FALSE),
position = c("topleft")) %>%
addScaleBar(position="bottomleft", options = scaleBarOptions(metric=F)) %>%
addSearchFeatures(targetGroups = "Markers",
options = searchFeaturesOptions(zoom=19,
autoCollapse = TRUE,
hideMarkerOnCollapse = TRUE)) %>%
addFullscreenControl()
nam <- paste0("Site_",i,"_Map")
assign(nam, tempmap)
# Create all datatables
temptable <- datatable(tmp[,c(1,8,10:11,6)],
rownames = F,
escape = FALSE,
extensions = c("Buttons"),
options = list(
searchHighlight = TRUE,
dom = "Bfrtip",
buttons = list("colvis",
list(extend = "collection",
buttons = list(
list(extend = "csv",
title = paste0(gsub("/", "-", labels[i]))),
list(extend = "excel",
title = paste0(gsub("/", "-", labels[i]))),
list(extend = "pdf",
title = paste0(gsub("/", "-", labels[i])),
orientation = "landscape")),
text = "Download"
))
))
nam2 <- paste0("Site_",i,"_Table")
assign(nam2, temptable)
}
knitr::opts_chunk$set(echo = TRUE, fig.align="center")
```
Home
=====================================
### About this Site
This is a website to hold the maps created from Google Places API retrievals. You can look at each map by clicking on the site name in the Maps navigation menu above or by selecting a site from the list below.
- [Site 1 - Koenig Ln]
- [Site 2 - FM 973]
- [Site 3 - Aquarena Springs Dr]
- [Site 4 - TX-80]
- [Site 5 - US-79/Palm Valley Blvd]
- [Site 6 - FM 620]
- [Site 7 - TX-29/University Ave]
- [Site 8 - FM 1460/AW Grimes Blvd]
- [Site 9 - FM 1431/Whitestone Blvd]
- [Site 10 - FM 1431/Whitestone Blvd]
- [Site 11 - FM 1431/Whitestone Blvd]
- [Site 12 - FM 685]
- [Site 13 - FM 685]
```{r, echo = FALSE, eval = TRUE}
# Output the pages for each site (with map on top, datatable on bottom)
out = NULL
for (i in 1:length(sites)) {
a1 <- paste0("\n\n",labels[[i]]," {data-navmenu='Maps'} \n")
a2 <- paste0("===================================== \n\n")
a3 <- "### Instructions \n"
a4 <- "Hover over a point to see the name of the business. Click a point to see its address and a link to the business's Google Maps page. \n\n"
a5 <- "### Map {.no-title } \n"
a6 <- "\n\n```{r, echo=FALSE,fig.height=7,fig.align='center'}\n" # start r chunk
a7 <- sprintf("\n Site_%d_Map", i)
a8 <- "\n\n```\n\n" # end r chunk
a9 <- "### Business Details \n"
a10 <- "\n\n```{r cols.print=7, echo=FALSE}\n" # start r chunk
a11 <- sprintf("\n Site_%d_Table", i)
a12 <- "\n\n```\n\n" # end r chunk
out <- c(out, knit_expand(text=paste0(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)))
}
```
`r paste(knit(text = out), collapse = '\n')`